<style type="text/less">
    @import "/web/public/public.less";

    .hot-search{
        .title {
            font-size: 16px;
            line-height: 60px;
            //border-bottom: 1px solid #EEEEEE;

            ul.tab-list{
                height: 30px;
                .fr;
                line-height: 30px;
                margin-top: 15px;
                &>li{
                    height: 100%;
                    .fl;
                    margin-left: 33px;
                    cursor: pointer;

                    &.active{
                        color: #e60012;
                        border-bottom: 1px solid #E60012;
                        cursor: default;
                    }
                }
            }
        }

        ul.hot-search-list {
            line-height: 24px;
            font-size: 14px;
            color: #6e6e6e;
            background-color: #FAFAFA;
            padding: 0 20px 15px;
        }

        ul.hot-search-list > li {
            height: 65px;
            padding-top: 15px;
            .ellipsis-mult(2);

        }
        h3{
            font-weight: normal;
        }

        .icon-rank {
            width: 18px;
            height: 18px;
            background: #EEEEEE;
            border-radius: 50%;
            color: #bfbdbd;
            text-align: center;
            line-height: 18px;
        }

        .icon-rank.hexagon {
            width: 20px;
            height: 11px;
            background-color: #FAB349;
            position: relative;
            color: #ffffff;
            font-size: 12px;
            line-height: 1;
            border-radius: 0;
        }

        .icon-rank.hexagon:before {
            content: "";
            position: absolute;
            top: -5px;
            left: 0;
            width: 0;
            height: 0;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-bottom: 5px solid #FAB349;
        }

        .icon-rank.hexagon:after {
            content: "";
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 0;
            height: 0;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-top: 5px solid #FAB349;
            vertical-align: text-bottom;
        }

        .icon-rank.rank-2 {
            background-color: #B0BED8;
        }

        .icon-rank.rank-2:before {
            border-bottom-color: #B0BED8;
        }

        .icon-rank.rank-2:after {
            border-top-color: #B0BED8;
        }

        .icon-rank.rank-3 {
            background-color: #F0C48A;
        }

        .icon-rank.rank-3:before {
            border-bottom-color: #F0C48A;
        }

        .icon-rank.rank-3:after {
            border-top-color: #F0C48A;
        }
        .icon-rank + span {
            display: inline-block;
            width: 230px;
            vertical-align: text-top;
            margin-left: 5px;
        }
    }
</style>
<script src="/web/lib/less.min.js"></script>
<#if channel.channelStatus == 1>
    <div class="hot-search" id="fragment-recommend-bid" data-num="${channel.channelCount}" data-keyword="空调">
        <div class="title">
            <h2 class="title_h2">
                <i class="title-line"></i>
                <a href="javascript:">${channel.channelName}</a>
            </h2>
            <ul class="tab-list">
                <li class="active">日</li>
                <li>周</li>
            </ul>
        </div>
        <ul class="hot-search-list">

        </ul>
    </div>
</#if>
<script>
    function getQueryBidTitle(type) {
        var now = new Date(
            $.ajax({
                url: '',
                async: false,
                method: 'get',
                dataType: '',
                context: document.body,
            }).getResponseHeader("Date")
        );
        var sevenAgo = new Date(now.getTime()-7*24*60*60*1000);
        var data = {
            pageNum: 0,
            sort: 4,
            pageSize: $('#fragment-recommend-bid').data('num'),
            queryText: $('#fragment-recommend-bid').data('keyword')
        };
        if(type==2){
            data = {
                pageNum: 0,
                sort: 4,
                pageSize: $('#fragment-recommend-bid').data('num'),
                queryText: "空调",
                startTime:sevenAgo.getFullYear()+'-'+(sevenAgo.getMonth()+1)+'-'+sevenAgo.getDate()+' 00:00:00',
                endTime:now.getFullYear()+'-'+(now.getMonth()+1)+'-'+now.getDate()+' 23:59:59'
            }
        }
        $.ajax({
            url:ports.queryBidTitle,
            data:data,
            success:function (res) {
                console.log('查询大标推荐列表',res);
                if(res.status == 200){
                var html = '';
                $.each(res.data.content,function (i,item) {
                    html += '<li>\n' +
                        '<h3><a href='+ '${yzbDomain}/detail/'+item.id +' target="_blank"><icon class="'+ 'icon-rank '+ (i<3?'hexagon':'') +' rank-' + (i+1) +'">'+ (i+1) +'</icon>\n' +
                        '    <span>'+ item.title +'</span>\n' +
                        '</a></h3></li>'
                });
                $('#fragment-recommend-bid .hot-search-list').html(html);
            }
            }
        })
    }
    getQueryBidTitle(1);
    var $aTabLi = $('.hot-search ul.tab-list>li');
    $aTabLi.click(function () {
        $(this).addClass('active').siblings().removeClass('active');

        console.log($(this).index())
        if($(this).index()==0){
            getQueryBidTitle(1)
        }else{
            getQueryBidTitle(2)
        }
    });
</script>
